<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html lang="en">
	<head>
		<base href="<%=basePath%>">
		<meta charset="utf-8" />
		<title></title>
		<meta name="description" content="overview & stats" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<link href="static/css/bootstrap.min.css" rel="stylesheet" />
		<link href="static/css/bootstrap-responsive.min.css" rel="stylesheet" />
		<link rel="stylesheet" href="static/css/font-awesome.min.css" />
		<!-- 下拉框 -->
		<link rel="stylesheet" href="static/css/chosen.css" />
		
		<link rel="stylesheet" href="static/css/ace.min.css" />
		<link rel="stylesheet" href="static/css/ace-responsive.min.css" />
		<link rel="stylesheet" href="static/css/ace-skins.min.css" />
		
		<link rel="stylesheet" href="static/css/datepicker.css" /><!-- 日期框 -->
		<script type="text/javascript" src="static/js/jquery-1.7.2.js"></script>
		<script type="text/javascript" src="static/js/jquery.tips.js"></script>
		<!-- 省市关联 -->
		  <script type="text/javascript" src="static/js/area/jquery-1.7.2.min.js"></script>
          <script type="text/javascript" src="static/js/area/TestAddress.js"></script>
          <script type="text/javascript" src="static/js/area/TestChooseAddress.js"></script>
         <script type="text/javascript">
	
        
         <!-- 省市关联 -->
         function loadProvince(regionId){
           $("#province_addr").html("");
           $("#province_addr").append("<option value=''>请选择省份</option>");
           var jsonStr = getAddress(regionId,0);
           for(var k in jsonStr) {
         	$("#province_addr").append("<option value='"+k+"'>"+jsonStr[k]+"</option>");
           }
           if(regionId.length!=6) {
         	$("#territorial_city").html("");
             $("#territorial_city").append("<option value=''>请选择城市</option>");
         	$("#id_areaSelect").html("");
             $("#id_areaSelect").append("<option value=''>请选择区域</option>");
           } else {
         	 $("#province_addr").val(regionId.substring(0,2)+"0000");
         	 loadCity(regionId);
           }
         }

         function loadCity(regionId){
           $("#territorial_city").html("");
           $("#territorial_city").append("<option value=''>请选择城市</option>");
           if(regionId.length!=6) {
         	$("#id_areaSelect").html("");
             $("#id_areaSelect").append("<option value=''>请选择区域</option>");
           } else {
         	var jsonStr = getAddress(regionId,1);
             for(var k in jsonStr) {
         	  $("#territorial_city").append("<option value='"+k+"'>"+jsonStr[k]+"</option>");
             }
         	if(regionId.substring(2,6)=="0000") {
         	  $("#id_areaSelect").html("");
               $("#id_areaSelect").append("<option value=''>请选择区域</option>");
         	} else {
         	   $("#territorial_city").val(regionId.substring(0,4)+"00");
         	   loadArea(regionId);
         	}
           }
         }

         function loadArea(regionId){
           $("#id_areaSelect").html("");
           $("#id_areaSelect").append("<option value=''>请选择区域</option>");
           if(regionId.length==6) {
             var jsonStr = getAddress(regionId,2);
             for(var k in jsonStr) {
         	  $("#id_areaSelect").append("<option value='"+k+"'>"+jsonStr[k]+"</option>");
             }
         	if(regionId.substring(4,6)!="00") {$("#id_areaSelect").val(regionId);}
           }
         }
     

	//保存
	function save(){
		if($("#bo_name").val()==""){
			$("#bo_name").tips({
				side:3,
	            msg:'请输入',
	            bg:'#AE81FF',
	            time:2
	        });
			$("#bo_name").focus();
			return false;
		}
		if($("#applicant").val()==""){
			$("#applicant").tips({
				side:3,
	            msg:'请输入',
	            bg:'#AE81FF',
	            time:2
	        });
			$("#applicant").focus();
			return false;
		}
		if($("#application_time").val()==""){
			$("#application_time").tips({
				side:3,
	            msg:'请输入',
	            bg:'#AE81FF',
	            time:2
	        });
			$("#application_time").focus();
			return false;
		}
		if($("#operating_margin").val()==""){
			$("#operating_margin").tips({
				side:3,
	            msg:'请输入',
	            bg:'#AE81FF',
	            time:2
	        });
			$("#operating_margin").focus();
			return false;
		}
		if($("#management_expense").val()==""){
			$("#management_expense").tips({
				side:3,
	            msg:'请输入',
	            bg:'#AE81FF',
	            time:2
	        });
			$("#management_expense").focus();
			return false;
		}
		if($("#registered_address").val()==""){
			$("#registered_address").tips({
				side:3,
	            msg:'请输入',
	            bg:'#AE81FF',
	            time:2
	        });
			$("#registered_address").focus();
			return false;
		}
		if($("#person").val()==""){
			$("#person").tips({
				side:3,
	            msg:'请输入',
	            bg:'#AE81FF',
	            time:2
	        });
			$("#person").focus();
			return false;
		}
		if($("#province").val()==""){
			$("#province").tips({
				side:3,
	            msg:'请输入',
	            bg:'#AE81FF',
	            time:2
	        });
			$("#province").focus();
			return false;
		}
		if($("#province_addr").val()==""){
			$("#province_addr").tips({
				side:3,
	            msg:'请输入',
	            bg:'#AE81FF',
	            time:2
	        });
			$("#province_addr").focus();
			return false;
		}
		if($("#territorial_city").val()==""){
			$("#territorial_city").tips({
				side:3,
	            msg:'请输入',
	            bg:'#AE81FF',
	            time:2
	        });
			$("#territorial_city").focus();
			return false;
		}
		if($("#creat_time").val()==""){
			$("#creat_time").tips({
				side:3,
	            msg:'请输入',
	            bg:'#AE81FF',
	            time:2
	        });
			$("#creat_time").focus();
			return false;
		}
		if($("#region").val()==""){
			$("#region").tips({
				side:3,
	            msg:'请输入',
	            bg:'#AE81FF',
	            time:2
	        });
			$("#region").focus();
			return false;
		}
		if($("#preparing_for_business").val()==""){
			$("#preparing_for_business").tips({
				side:3,
	            msg:'请输入',
	            bg:'#AE81FF',
	            time:2
	        });
			$("#preparing_for_business").focus();
			return false;
		}
		if($("#budget_management_fee").val()==""){
			$("#budget_management_fee").tips({
				side:3,
	            msg:'请输入',
	            bg:'#AE81FF',
	            time:2
	        });
			$("#budget_management_fee").focus();
			return false;
		}
		if($("#introducer").val()==""){
			$("#introducer").tips({
				side:3,
	            msg:'请输入',
	            bg:'#AE81FF',
	            time:2
	        });
			$("#introducer").focus();
			return false;
		}
		if($("#introducer_phone").val()==""){
			$("#introducer_phone").tips({
				side:3,
	            msg:'请输入',
	            bg:'#AE81FF',
	            time:2
	        });
			$("#introducer_phone").focus();
			return false;
		}
		if($("#relation_company").val()==""){
			$("#relation_company").tips({
				side:3,
	            msg:'请输入',
	            bg:'#AE81FF',
	            time:2
	        });
			$("#relation_company").focus();
			return false;
		}
		if($("#add_info_man").val()==""){
			$("#add_info_man").tips({
				side:3,
	            msg:'请输入',
	            bg:'#AE81FF',
	            time:2
	        });
			$("#add_info_man").focus();
			return false;
		}
		$("#Form").submit();
		$("#zhongxin").hide();
		$("#zhongxin2").show();
	}
	
</script>
	</head>
<body>
	<form action="boapply/${msg }.do" name="Form" id="Form" method="post">
		<input type="hidden" name="bo_id" id="bo_id" value="${pd.bo_id}"/>
		<div id="zhongxin">
		<table id="table_report" class="table table-striped table-bordered table-hover">
			<tr>
				<td style="width:150px;text-align: right;padding-top: 13px;">分公司名称:</td>
				<td><input type="text" name="bo_name" id="bo_name" value="${pd.bo_name}" maxlength="32" placeholder="这里输入" title=""/></td>
			</tr>
			<tr>
				<td style="width:70px;text-align: right;padding-top: 13px;">申请人:</td>
				<td><input type="text" name="applicant" id="applicant" value="${pd.applicant}" maxlength="32" placeholder="这里输入" title=""/></td>
			</tr>
			
			<tr>
				<td style="width:70px;text-align: right;padding-top: 13px;">开展业务:</td>
				<td>
				<input type='checkbox' name="preparing_for_business" id="preparing_for_business" value="111" /><span class="lbl">111</span>&nbsp;&nbsp;
				<input type='checkbox' name='ids' value="222" /><span class="lbl">222</span>&nbsp;&nbsp;
				<input type='checkbox' name='ids' value="333" /><span class="lbl">333</span>
				<%-- <label><input type="text"  name="preparing_for_business"  id="preparing_for_business"  value="${pd.preparing_for_business}"/></label> --%>
				</td>
			</tr>
			<tr>
				<td style="width:70px;text-align: right;padding-top: 13px;">经营保证金:</td>
				<td><input type="text" name="operating_margin" id="operating_margin" value="${pd.operating_margin}" maxlength="32" placeholder="这里输入" title=""/></td>
			</tr>
			
			<tr>
				<td style="width:70px;text-align: right;padding-top: 13px;">注册地址:</td>
				<td><input type="text" name="registered_address" id="registered_address" value="${pd.registered_address}" maxlength="32" placeholder="这里输入" title=""/></td>
			</tr>
			<tr>
				<td style="width:70px;text-align: right;padding-top: 13px;">负责人:</td>
				<td><input type="text" name="person" id="person" value="${pd.person}" maxlength="32" placeholder="这里输入" title=""/></td>
			</tr>
			<tr>
				<td rowspan="3" style="width:70px;text-align: right;padding-top: 13px;">所在省份:</td>
				<td> 
					<select id="province_addr" name="province_addr" onChange="loadCity(this.value);"><option value="${pd.province_addr}">请选择省份</option></select>
				</td>
			</tr>
			<tr>
				<td>
					<select id="territorial_city" name="territorial_city" onChange="loadArea(this.value);"><option value="${pd.territorial_city }">请选择城市</option></select>
				</td>
			</tr>
			<tr>
				<td>
					<select id="id_areaSelect" name="areaSelect"><option value="">请选择区域</option></select><SCRIPT LANGUAGE="JavaScript">loadProvince('440116');</SCRIPT>
				</td>
			</tr>
			<tr>
				<td style="width:70px;text-align: right;padding-top: 13px;">详细地址:</td>
				<td><input type="text" name="region" id="region" value="${pd.region}" maxlength="32" placeholder="这里输入" title=""/></td>
			</tr>
			
			<tr>
				<td style="width:70px;text-align: right;padding-top: 13px;">管理费:</td>
				<td><input type="text" name="budget_management_fee" id="budget_management_fee" value="${pd.budget_management_fee}" maxlength="32" placeholder="这里输入" title=""/></td>
			</tr>
			
			<tr>
				<td style="width:70px;text-align: right;padding-top: 13px;">介绍人:</td>
				<td><input type="text" name="introducer" id="introducer" value="${pd.introducer}" maxlength="32" placeholder="这里输入" title=""/></td>
			</tr>
			<tr>
				<td style="width:70px;text-align: right;padding-top: 13px;">介绍人联系电话:</td>
				<td><input type="text" name="introducer_phone" id="introducer_phone" value="${pd.introducer_phone}" maxlength="32" placeholder="这里输入" title=""/></td>
			</tr>
			<tr>
				<td style="width:70px;text-align: right;padding-top: 13px;">与公司关系:</td>
				<td><input type="text" name="relation_company" id="relation_company" value="${pd.relation_company}" maxlength="32" placeholder="这里输入" title=""/></td>
			</tr>
			<tr>
				<td style="width:70px;text-align: right;padding-top: 13px;">填写该信息人员:</td>
				<td><input type="text" name="add_info_man" id="add_info_man" value="${pd.add_info_man}" maxlength="32" placeholder="这里输入" title=""/></td>
			</tr>
			 <tr >
			      <td style="width:70px;text-align: right;padding-top: 13px;">洽谈出结果时间:</td>
			      <td><input type="text" class="form_datetime" name="end_time" id="end_time" value="${pd2.end_time }"/></td>
			 </tr>
			  <tr >
			      <td style="width:70px;text-align: right;padding-top: 13px;">协议截止日期:</td>
			      <td><input type="text" name="expire" class="form_datetime" id="expire" value="${pd.expire}"/></td>
			 </tr>
			  <tr >
			      <td style="width:70px;text-align: right;padding-top: 13px;">分公司协议附件:</td>
			      <td><input type="text" name="enclosure" id="enclosure" value="${pd.enclosure}"/></td>
			 </tr>
			<tr>
				<td style="text-align: center;" colspan="10">
					<a class="btn btn-mini btn-primary" onclick="save();">保存</a>
					<a class="btn btn-mini btn-danger" onclick="top.Dialog.close();">取消</a>
				</td>
			</tr>
		</table>
		</div>
		
		<div id="zhongxin2" class="center" style="display:none"><br/><br/><br/><br/><br/><img src="static/images/jiazai.gif" /><br/><h4 class="lighter block green">提交中...</h4></div>
	</form>
		<!-- 引入 -->
		<script type="text/javascript">window.jQuery || document.write("<script src='static/js/jquery-1.9.1.min.js'>\x3C/script>");</script>
		<script src="static/js/bootstrap.min.js"></script>
		<script src="static/js/ace-elements.min.js"></script>
		<script src="static/js/ace.min.js"></script>
		<script type="text/javascript" src="static/js/chosen.jquery.min.js"></script><!-- 下拉框 -->
		<script type="text/javascript" src="static/js/bootstrap-datepicker.min.js"></script><!-- 日期框 -->
		<script type="text/javascript">
		$(top.hangge());
		$(function() {
			
			//单选框
			$(".chzn-select").chosen(); 
			$(".chzn-select-deselect").chosen({allow_single_deselect:true}); 
			
			//日期框
			$('.date-picker').datepicker();
			
		});
		
		</script>
</body>
</html>